package com.varian.auth.authentication;

import com.varian.auth.service.IOAuth2AuthorizationInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
import org.springframework.security.oauth2.server.authorization.OAuth2TokenType;

/**
 * @author ben
 * @since 2024/6/30
 */
@RequiredArgsConstructor
public class VarianOAuth2AuthorizationService implements OAuth2AuthorizationService {

    private final IOAuth2AuthorizationInfoService authorizationService;

    @Override
    public void save(OAuth2Authorization authorization) {
        authorizationService.save(authorization);
    }

    @Override
    public void remove(OAuth2Authorization authorization) {
        authorizationService.remove(authorization);
    }

    @Override
    public OAuth2Authorization findById(String id) {
        return authorizationService.findById(id);
    }

    @Override
    public OAuth2Authorization findByToken(String token, OAuth2TokenType tokenType) {
        return authorizationService.findByToken(token, tokenType);
    }
}
